import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util'
import { cloneDeep } from 'lodash-es'
/** 用户订单属性 */
export interface UserOrderProperty {
  // 组件样式
  style: ComponentStyle
  // 订单列表
  list: UserOrderItemProperty[]
  // 查看全部文本
  showAllText: string
}

/** 用户订单项目属性 */
export interface UserOrderItemProperty {
  title: string
  value: string
  icon: string
  path: string
  type: string
  count: string
}

export const EMPTY_USER_ORDER_ITEM_PROPERTY = {
  title: '待付款',
  value: '1',
  icon: '/static/images/order/no_pay.png',
  path: '/pages/order/list',
  type: 'nopay',
  count: 'unpaidCount'
} as UserOrderItemProperty  

// 定义组件
export const component = {
  id: 'UserOrder',
  name: '订单',
  icon: 'ep:list',
  property: {
    style: {
      bgType: 'color',
      bgColor: '',
      marginLeft: 8,
      marginRight: 8,
      marginBottom: 8
    } as ComponentStyle,
    list: [cloneDeep(EMPTY_USER_ORDER_ITEM_PROPERTY)],
    showAllText: '查看全部'
  }
} as DiyComponent<UserOrderProperty>
